package com.xinnet.mms.cart.dao.impl;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.xinnet.core.utils.page.PageView;
import com.xinnet.mms.allot.dao.impl.BaseDaoImpl;
import com.xinnet.mms.cart.dao.ShopCartDao;
import com.xinnet.mms.entity.ShopCart;
/**
 * 
 * @author 王湛智
 *
 */
@Repository("shopCartDao")
public class ShopCartDaoImpl extends BaseDaoImpl<Object,Object> implements ShopCartDao {

	/**
	 * 根据会员ID取得该会员购物车内的产品
	 */
	@Override
	public List<ShopCart> getShopCartByCusId(String cusId) throws SQLException {
		return this.getSqlSession().selectList("shopCart.getShopCartByCusId",cusId);
	}

	/**
	 * 根据会员ID查询该会员购物车内的产品(分页)
	 */
	@Override
	public PageView<ShopCart> queryShopCartByCusIdPageView( PageView<ShopCart> pageView,String cusId) throws SQLException {
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("paging", pageView);
		map.put("t", cusId);
		pageView.setRecords(this.getSqlSession().selectList("shopCart.queryShopCartByCusIdPageView",map));
		return pageView;
	}

}
